	<a
		href="<?php
	    echo $this->url(array('controller' => 'photo', 'action' => 'index','request'=>$this->user),"default")?>">
	    <?php
	    echo $this->translate("Photos");
	    ?></a>
	    


<?php
if($this->user==Zend_Auth::getInstance()->getIdentity()->login){
    ?>
    <a
		href="<?php
	    echo $this->url(array('controller' => 'photo', 'action' => 'removealbum','request'=>$this->album_id),"default")?>">
	    <?php
	    echo $this->translate("Delete album");
	    ?>
	    </a>
	    
     <?php 
    echo $this->form;
    
}


?>


<div id="gallery">
<?php 

$i= 0;
$stage_width=1100;
$stage_height=900;
$dir = $this->dir;
?>
<?php foreach ($this->photos as $photo):?>

<?php 

        $left = rand(0,$stage_width);
        $top = rand(0,400);
        $rot = rand(-40,40);

        if($top>$stage_height-130 && $left > $stage_width-230)
        {
            /* Prevent the images from hiding the drop box */
            $top-=120+130;
            $left-=230;
        }

        //use split and tag 'rel', cause jquery don't see point on accessing by id
        $photo_id = split("\.", $photo);
        
        echo '
        <div id="'.$photo_id[0].'" rel="'.$photo.'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$dir.'/thumb/'.$photo.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
        <a class="fancybox" rel="fncbx" href="'.$dir.'/'.$photo.'" target="_blank">'.$photo.'</a>
        </div>';
?>

<?php endforeach;?>

<?php if($this->user==Zend_Auth::getInstance()->getIdentity()->login):?>
   <div class="drop-box" >
	</div>
<?php endif;?>



</div>

<div class="clear"></div> 
<div id="<?php echo $this->album_id?>" class="album_id"></div>